const path = require('path');

module.exports = {
    publicPath: '/crab-ui/',
    runtimeCompiler: true,
    pages: {
        index: {
            entry: 'docs/main.ts',
            template: 'public/index.html',
            filename: 'index.html'
        }
    },
    configureWebpack: {
        output: {
            libraryExport: 'default'
        }
    },
    chainWebpack: config => {
        config.resolve.alias
            .set('@',path.resolve('docs'))
            .set('~',path.resolve('packages'));

        config.module
            .rule('js')
            .rule('ts')
            .include.add(/package/).end()
            .include.add(/docs/).end()
            .use('babel')
            .loader('babel-loader')
            .tap(option => option);
    }
}